//
//  FQDMultiColumnsCollectionViewLayout.h
//  FakeQDaily
//
//  Created by mewxiv on 9/14/16.
//  Copyright © 2016 Xensius. All rights reserved.
//

#import <UIKit/UIKit.h>

@protocol FQDMultiColumnsCollectionViewLayoutDelegate <UICollectionViewDelegate>
@required
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath;

@optional
- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section;
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section;
// 为每个section单独指定列数
- (NSInteger)collectionView:(UICollectionView *)collectionView columnCountForSection:(NSInteger)section;

@end

@interface FQDMultiColumnsCollectionViewLayout : UICollectionViewLayout

// 指定所有section的列数，代理实现了columnCountForSection:方法时将使用该方法的返回值，忽略该变量的值
@property (nonatomic, assign) NSUInteger columnCount;
@property (nonatomic, assign) CGFloat minimumColumnSpacing;
@property (nonatomic, assign) CGFloat minimumLineSpacing;
@property (nonatomic, assign) UIEdgeInsets sectionInset;
@property (nonatomic, weak) id<FQDMultiColumnsCollectionViewLayoutDelegate> delegate;

- (CGFloat)columnWidthForSection:(NSUInteger)section;

@end
